<template>
  <ul class="detail-bottom">
      <div class="comment" v-show="comments.total">
        <p @click="selectComments(comments)">☁ {{comments.total}} </p>
      </div>
      <li class="bottom-top" @click="selectAllMusic">
          <div class="bottom-icon"></div>
          <div class="bottom-title">播放全部</div>
      </li>
      <li v-for="value in playlist" :key="value.id" class="item" @click="selectMusic(value.id)">
        <h3>{{value.name}}</h3>
        <p>{{value.al.name}}-{{value.ar[0].name}}</p>
      </li>
      <li class="bottom-bottom"></li>
  </ul>
</template>

<script>
import { mapActions } from 'vuex'
export default {
  name: 'DetailBottom',
  props: {
    playlist: {
      type: Array,
      default: () => [],
      required: true
    },
    comments: {
      type: Object,
      default: () => {},
      required: true
    }
  },
  methods: {
    ...mapActions([
      'setFullScreen',
      'setMiniScreen',
      'setSongDetail',
      'setIsCommentsList',
      'setCommentsList'
    ]),
    selectMusic (id) {
      this.setFullScreen(true)
      this.setMiniScreen(false)
      this.setSongDetail([id])
      this.$bus.$emit('MusicComment', id)
    },
    selectAllMusic () {
      this.setFullScreen(true)
      const ids = this.playlist.map(function (item) {
        return item.id
      })
      this.setSongDetail(ids)
    },
    selectComments (comments) {
      this.setIsCommentsList(true)
      this.$bus.$emit('detailImg')
    }
  }

}
</script>

<style scoped lang='scss'>
@import "../../assets/css/mixin";
@import "../../assets/css/variable";
.detail-bottom{
    width: 100%;
    li{
        width: 100%;
        height: 100px;
        padding-left: 20px;
        padding-right: 20px;
        padding-top: 5px;
        box-sizing: border-box;
        @include bg_sub_color();
        border-bottom: 2px solid #ccc;
        position: relative;
    }
    .bottom-top{
        display: flex;
        align-items: center;
        .bottom-icon{
            width: 60px;
            height: 60px;
            @include bg_img('../../assets/images/small_play');
            margin-right: 20px;
        }
        .bottom-title{
            @include font_color();
            @include font_size($font_large);
        }
    }
    .bottom-bottom{
      width: 100%;
      height: 150px;
      border-bottom: transparent
    }
    .item{
        h3{
            @include font_color();
            @include font_size($font_medium);
            @include clamp(1);
            margin-bottom: 8px;
        }
        p{
            @include font_color();
            @include font_size($font_samll);
            @include clamp(1);
            opacity: 0.8;
        }
    }
    .comment{
      width: 300px;
      height: 80px;
      position: absolute;
      @include bg_sub_color();
      top: -60px;
      left: 50%;
      transform: translateX(-50%);
      z-index: 9;
      border-radius: 40px;
      box-shadow:  0px 10px 10px 1px #bbb;
      display: flex;
      justify-content: center;
      p{
        font-size: 50px;
        color: #ccc;
        line-height: 80px;
      }
    }
}
</style>
